package com.spring.sd.configurationtest;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * date: 2024/5/6
 */
public class MainTest1 {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(UserConfig.class);

        UserConfig userConfig = context.getBean(UserConfig.class);
        System.out.println(userConfig);

        UserA userA = context.getBean(UserA.class);
        System.out.println(userA);

        UserB userB1 = (UserB) context.getBean("userB1");
        UserB userB2 = (UserB) context.getBean("userB2");
        System.out.println(userB1.getUserA());
        System.out.println(userB2.getUserA());

        context.close();
    }
}
